<html>
    <head>
        <meta charset="utf8" />
    </head>
    <style>
        
    </style>
<body>
    <div id="app">
    <form novalidate>
        <input type="text" v-model="count" />
        <input type="text" v-model="older.name" />
        <span v-bind="count">  </span>
        <span v-bind="older.name"></span>
    </form>
     <button v-click="testShow('1232')" >dianwo </button>        
</div>
<script src="testvender.js"></script>
<script>
    var dd=new Vue({
    el:"#app",
    data:{
        count:1,
        older:{
            name:"扫地僧",
            age:19,
        }
    },
    methods:{
        testShow:function(key){
            this.count++;
            console.log(this.count)
            // alert(key);
        }
    }
});
setTimeout(function(){
    dd._data.count=111;
},'10000');
function cached (fn) {
  var cache = Object.create(null);
  return (function cachedFn (str) {
      var yrr=1;
    var hit = cache[str];
   var ssw= hit?hit:(
        cache[str] = fn(str)//fn(str)
        );
    return ssw
  })
}
// var sd=cached((num)=>{
//      console.log(num);
//      return 1;
// })
// console.log(sd);
// // var sayhello=(
// //     console.log("ss")
// // );
// // console.log(sayhello);


// var a={n:2};
// a.x=a={n:1};
// console.log(a.x);//?
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
  return str.replace(camelizeRE, function (_, c) { 
      console.log(_);
      return c ? c.toUpperCase() : ''; })
});

var styleObj=cached((str)=>{
   return  str.replace(/[A-Z]/g,function(dd){
        return "-"+dd.toLowerCase();
})
})
var  capitalize=cached((str)=>{
    return str.charAt(0).toUpperCase()+str.slice(1);
});
//console.log(capitalize("fontsize"));
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
  return str
    .replace(hyphenateRE, '$1-$2')
   // .replace(hyphenateRE, '$1-$2')
    //.toLowerCase()
});

//console.log(hyphenate("sizFFontSizeColor"))
 
 function extend(to,_form){
     
    for(var key in _form){
        to[key]=_form[key];
    }
    return to ;
 }
 function toObject(arr){
    var res={};
     for (var i=0;i<arr.length;i++){
         if(arr[i]){
             extend(res,arr[i]);
         }
     }
     return res
 }
 console.log(toObject([{name:1213,age:121},{sex:"qq",name:"jji"}]))


 function tco(f) {
  var value;
  var active = false;
  var accumulated = [];

  return function accumulator() {
      debugger
    accumulated.push(arguments);
    if (!active) {
      active = true;
      while (accumulated.length) {
        value = f.apply(this, accumulated.shift());
      }
      active = false;
      return value;
    }
  };
}

var sum = tco(function(x, y) {
  if (y > 0) {
    return sum(x*y, y - 1)
  }
  else {
    return x
  }
});
//代码覆盖率工具 Istanbul 
sum(1, 3)

</script>
</body>
</html>